package com.ddtech.business.practice.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @version v1.0
 * @ClassName:SerialNumberGenerator description：
 * @author:wei_zhang(xiao)
 * @date: 2024-07-17 13:53
 */
public class SerialNumberGenerator {

    public SerialNumberGenerator(){

    }
    private static int counter = 0;

    public static synchronized String generateSerialNumber() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = dateFormat.format(new Date());
        return timestamp + String.format("%03d", counter++);
    }
}
